package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.OperateLogMapper;

import com.itheima.pojo.OperateLog;
import com.itheima.pojo.PageBean;
import com.itheima.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private OperateLogMapper operateLogMapper;

    @Override
    public PageBean log(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);

        List<OperateLog> list = operateLogMapper.log();

        Page<OperateLog> pageBean = (Page<OperateLog>) list;

        return new PageBean(pageBean.getTotal(),pageBean.getResult());

    }
}
